// src/api/department.js
import request from '@/utils/request.js';

/**
 * 获取学院列表
 * @param {number} pageNum - 当前页码
 * @param {number} pageSize - 每页显示数量
 * @param {number} orderBy - 排序方式
 * @param {Object} departmentData - 查询条件
 */
export function getDepartmentList(pageNum, pageSize, orderBy, departmentData) {
  return request({
    url: `/department/findall/${pageNum}/${pageSize}/${orderBy}`,
    method: 'post',
    data: departmentData
  });
}

/**
 * 添加学院
 * @param {Object} data - 学院信息
 */
export function addDepartment(data) {
  return request({
    url: '/department/insert',
    method: 'post',
    data
  });
}

/**
 * 修改学院
 * @param {Object} data - 学院信息
 */
export function updateDepartment(data) {
  return request({
    url: '/department/update',
    method: 'put',
    data
  });
}

/**
 * 删除学院
 * @param {string} departmentId - 学院ID
 */
export function deleteDepartment(departmentId) {
  return request({
    url: `/department/delete/${departmentId}`,
    method: 'delete'
  });
}

/**
 * 获取学院详情
 * @param {string} departmentId - 学院ID
 */
export function getDepartmentDetail(departmentId) {
  return request({
    url: `/department/${departmentId}`,
    method: 'get'
  });
}